<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Product>" %>

<%@ Import Namespace="AspNetMvcViewBestPractices.Helpers" %>
<%@ Import Namespace="AspNetMvcViewBestPractices.Models" %>
<asp:content id="Content2" contentplaceholderid="MainContent" runat="server">

    <div class="example">
        <h2>Logic inside the view</h2>    
<div class="stockLevel
   <%=Model.UnitsInStock == 0 ? " stockLevelNone" : String.Empty%>
   <%=Model.UnitsInStock > 0 && Model.UnitsInStock <= 20 ? " stockLevelLow" : String.Empty%>
   <%=Model.UnitsInStock > 20 ? " stockLevelHigh" : String.Empty%>
   ">
    <span>Number Of Units In Stock: <%=Model.UnitsInStock %></span>
</div>
    </div>
    
    <div class="example">
        <h2>Using the ProductCssHelper</h2>    
        <div class="stockLevel <%=ProductCssHelper.GetCssClassForUnitsInStock(Model.UnitsInStock)%>">        
            <span>Number Of Units In Stock: <%=Model.UnitsInStock %></span>
        </div>
    </div>
    
    <div class="example">        
        <h2>Using the ProductHtmlHelper</h2>    
        <%=ProductHtmlHelper.GetHtmlForUnitsInStock(Model.UnitsInStock)%>
     </div>
     
     <div class="example">        
        <h2>When you need to show all css options in the view</h2>    
        <div class="stockLevel <%=ProductCssHelper.SelectCssClassForUnitsInStock(Model.UnitsInStock,"stockLevelNone","stockLevelLow","stockLevelHigh")%>">        
            <span>Number Of Units In Stock: <%=Model.UnitsInStock %></span>
        </div>
     </div>
     
     <%=Html.ActionLink("Show example using mapper", "DisplayProductUsingMapper") %>
    
</asp:content>
